// 引入request
import request from '../util/request.js';

const ComposeRequest = {
    BASE_URL : "http://localhost:8085/pro",
    // 请求过程在这里开发，不在.vue文件中开发
    /**
     * 分页查询步骤信息的API
     * @param compose
     * @param callBack
     */
    loadCompose(compose, callBack){
        // 拼接url  /sys/queryByPage?xxx
        console.log("请求参数是111")
        console.dir(compose)
        let url = this.BASE_URL + "/compose/queryByPage";
        //let url = this.BASE_URL + "/compose/queryByPage";  调用request进行请求  http://lcation
        request.get(url,compose,callBack);
    },
    /**
     * 获取所有工序的API
     */
    getProcessList(callBack){
        let url = this.BASE_URL + "/process/queryAll";
        request.get(url,null,callBack);
    },

    /**
     * 添加步骤的API
     * @param compose
     * @param callBack
     */
    addCompose(compose,callBack){
        let url = this.BASE_URL + "/compose/saveCompose"
        request.post(url,compose,callBack);
    },
    /**
     * 通过id查询步骤信息的API
     * @param composeId
     * @param callBack
     */
    getById(composeId,callBack){
        let url = this.BASE_URL + "/compose/queryById?composeId=" + composeId;
        request.get(url,null,callBack);
    }
    ,
    /**
     * 修改步骤信息的API
     * @param compose
     * @param callBack
     */
    updateCompose(compose,callBack){
        let url = this.BASE_URL + "/compose/update";
        request.post(url,compose,callBack);
    },
    /**
     *  删除步骤的API
     *  @param composeId
     *  @param callBack
     */
    deleteCompose(composeId,callBack){
        request.get(this.BASE_URL + "/compose/delete?composeId=" + composeId,null,callBack);
    },
    /**
     * 批量删除步骤的API
     * @param composeIds
     * @param callBack
     */
    deleteComposes(composeIds,callBack){
        let url = this.BASE_URL + "/compose/deletes?a=1&composeIds="+composeIds;
        request.get(url,null,callBack);
    }
}
// 导出我们申明的composerequest对象
export default ComposeRequest;